import { onMounted, onUnmounted, reactive } from 'vue'
export default function () {
  const mouse = reactive({
    x: 0,
    y: 0
  })

  const move = e => {
    mouse.x = e.pageX
    mouse.y = e.pageY
  }
  onMounted(() => {
    document.addEventListener('mousemove', move)
  })
  onUnmounted(() => {
    document.removeEventListener('mousemove', move)
  })
  return mouse
}
